# -*- coding: utf-8 -*-
from model import Collection, db
from time import time


class Recruitment(Collection):

    collection = db.recruitment

    class Field(object):
        _id = '_id'
        createTime = 'createTime'
        description = 'description'
        title = 'title'
        salary = 'salary'
        updateTime = 'updateTime'

    @staticmethod
    def new_recruitment(title, salary, description):
        return Recruitment.insert({
            Recruitment.Field.createTime: int(time() * 1000),
            Recruitment.Field.title: title,
            Recruitment.Field.salary: salary,
            Recruitment.Field.description: description,
            Recruitment.Field.updateTime: int(time() * 1000)
        })
